To this point in your object-oriented design work, you have been considering the design of classes mostly in isolation. When you move to the development of larger software systems those skills need to be expanded. You need to begin considering how classes effect other classes, and how they interact with each other. There are a number of principles that have been put forward for quality object-oriented designs. We will discuss object-oriented design in more detail in two lessons. Each lesson will focus on design principles from the two sets of principles known as SOLID and GRASP (General responsibility assignment software patterns/principles). This first lesson will also cover the Law of Demeter.
This lesson will look at these principles:
Single responsibility (SOLID)
Open/Closed (SOLID)
Dependency inversion/injection (SOLID)
Controller (GRASP)
Information expert (GRASP)
Low coupling (GRASP)
Pure Fabrication (GRASP)
Law of Demeter
Learning Outcomes
Describe the principles: Single responsibility, Dependency inversion/injection
Give an example of a design that observes the single responsibility principle and one that does not.
Explain how dependency injection is helpful for testing
Explain why low coupling and high cohesion are principles in tension with each other
Explain the Law of Demeter and why violations of the law increase the coupling in a system
Explain how the Information expert design principle enforces behavior follows data
Analyze an object-oriented software design for adherence to these design principles.
Study Resources
For your study of this topic, use these resources.
Learning S.O.L.I.D. Programming Principles by Steven Lott available on lynda.com through the RIT library. The examples are in Python but the principles still hold.
(3:12)
(3:58)
(up to 4:00) - Ignore Adapter pattern reference for now
(5:31)
Overview of the SOLID Principles (3:26) from Learning S.O.L.I.D. Programming Principles available through the RIT library gives a general introduction to the principles. The examples are in Python but the principles still hold
GRASP Patterns (5:20) from Learning S.O.L.I.D. Programming Principles. Gives a general introduction to the principles. The examples are in Python but the principles still hold.
Beginning SOLID Principles and Design Patterns for ASP.NET Developers by Bipin Joshi available on O'Reilly
Chapter 2 - SOLID Principles as well as the links to its sections Single Responsibility Principle (SRP), and Dependency Inversion Principle (DIP) Only (SRP),(LSP) and (DRP) for now
The completion of this exercise may be delayed until just before you complete your implementation of the Elaboration phase user stories. The team should look to complete this soon rather than leaving things until the last minute. Make sure to keep track of this work to not have it surprise you when it is shown as due in the schedule.
For this exercise, you will look at the design of your term project in the Elaboration phase considering two of the following principles covered in this lesson.
Single responsibility
Open/Closed
Low coupling
Information expert
Dependency inversion/injection
Law of Demeter
Controller
Pure Fabrication
For each principle, do the following:
Describe how the principle is applied in your design
Suggest improvements to your current design to get better adherence to the principle
This is an individual exercise. Across the team, each of the design principles above must be covered at least once by some team member, but none should be covered by more than two team members.
Your discussion of each principle should be one to two pages including any UML class structure diagrams that will be helpful to your explanation. Be sure to review the Static UML Review Sheet to ensure your class diagrams are using correct format and syntax.
By the date specified in your section's schedule, submit a Word or PDF file to the myCourses Assignments folder, Object-oriented design - individual, in the Exercises section.